Processes Introduction and Management

Processes Introduction and Management

06-26-32-linux-31-Jul-2025.png

Introduction to Processes :

  • processes is Program running in the Background of a system.
  • they are Managed by the Kernel.
  • the kernel Assign's the Process that has a unique PID and it gets incremented for the order. Example 60th proccess = PID 60.

Viewing Process ps ps aux:

ps => display current proccess runed by the user
ps aux => display current proccess runs on the system and   all users.

ps:
06-45-14-linux-31-Jul-2025.png

  • ps aux:
    06-49-56-linux-31-Jul-2025.png

Important Columns in ps aux:

  1. USER : the user who initiated the process
  2. PID : the Process id
  3. %CPU : CPU usage in %
  4. COMMAND : the Command that started the Process

Filtering Process use grep:

# in other tab start Metasplolit
msfconsole
ps aux | grep msfconsole
  • by using ctrl + shift + F:
    07-05-35-linux-31-Jul-2025.png
  • by grep:
    07-08-12-linux-31-Jul-2025.png

07-03-35-linux-31-Jul-2025.png


Managing Processes:

  • Kill and types ✅
  • proccess priority with nice
  • running poccess in background ✅
  • foregrounding proccess ✅
  • scheduling process and automation cron and at overview

Finding greediest process with top or the modern option htop:

  • the top or htop comes in handy if u want to find the greediest process.
top
htop

Note ps vs top:

  • ps = ordered by the pid ascending order
  • top = order by by the greediest.

07-12-33-linux-31-Jul-2025.png


Stop (kill) process:

  • kill this command does what it says it kills the proccess but there are some options they way to end the proccess.
  • We can stop a proccess by using top shutdown the proccess by pressing F9 and then you have to choose the kill signals.
  • u can use kill command for faster approach kill [pid] it will preform the default kill options => SIGTERM.
    syntax for kill in terminal:
kill -(n) [pid]
kill -9 1333
     SIGKILL		

Comman killsignals options:

SIGUP -1 => stops and restart proccess with same id
SIGSTOP -19 => stop/suspend a proccess
SIGINT -2 => the interupt the weakest kill sgnal
SIGQUIT -3 =>  terminates a proccess the saves it in file named core
SIGTERM -15 => the default kill signal and do clean up tasks
SIGKILL -9 => the absolute kill signal it forces the proccess to s
stop by sending to /dev/null and doesnt do cleanup.

  • ex: using kill command to Stop a process: am killing my Metasploit sessionkill 91475

09-35-39-linux-31-Jul-2025.png
09-35-27-linux-31-Jul-2025.png

ex: Using htop kill a process:

08-33-09-linux-31-Jul-2025.png

08-31-40-linux-31-Jul-2025.png


Running process in background:

  • This is helpful when u need to open a Tool or Application and use the same terminal session
[tool/application] &
# dont forget[and]
firefox &

ex: mousepad & -> it will this text editor and it will be running in Background.
09-42-43-linux-31-Jul-2025.png


foregrounding a process :

  • The fg command in Linux brings a background job to the foreground. It lets you continue working with a paused or background-running task in your terminal.

  • Just type fg to resume the most recent job, or fg %job_number or fg [pid] if it was running in background[&] for a specific one.

  • jobs command to view job and jon number [n].
    suspend the msfconsole by pressing ctrl + z then run fg
    command then press ctrl+c to bring the session back to normal
    10-22-20-linux-31-Jul-2025.png - if the fg only has on job running in the foreground
    10-29-26-linux-31-Jul-2025.png

  • if running multiple %jobs example use fg %Job_num:
    10-30-50-linux-31-Jul-2025.png

  • viewing running jobs command
    10-33-02-linux-31-Jul-2025.png


Task and job management Automation (Introduction)

  • scheduling process and automation cron and at overview
  • create a small script
  • To test at and cron i wrote simple bash script down below.
  • create .sh format and sudo chmod +x script.sh
  • then execute ./script.sh
    carbon.png